package com.genesis.web.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.genesis.mall.common.Result;
import com.genesis.mall.entity.UmsMemberLevel;
import com.genesis.mall.service.IUmsMemberLevelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 会员等级表 前端控制器
 * </p>
 *
 * @author author
 * @since 2022-08-01
 */
@RestController
//@RequestMapping("/ums-member-level")
@RequestMapping("/memberLevel")
@Slf4j
public class UmsMemberLevelController {

    @Autowired
    private IUmsMemberLevelService umsMemberLevelService;

    /**
     * 查询会员信息
     * @param defaultStatus
     * @return
     */
    @GetMapping("/list")
    public Result<List<UmsMemberLevel>> list(int defaultStatus){
        log.info("查询会员信息");

        //条件构造器
        LambdaQueryWrapper<UmsMemberLevel> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(UmsMemberLevel::getDefaultStatus,defaultStatus);
        List<UmsMemberLevel> list = umsMemberLevelService.list(queryWrapper);

        return Result.success(list);
    }
}
